import java.util.Scanner;
// 1:无需package
// 2: 类名必须Main, 不可修改

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int n = scan.nextInt();
        long[] arr = new long[n+1];
        long[] s = new long[n+1];
        long ans = 0;
        for(int i=1; i<=n;i++){
            arr[i] = scan.nextInt();
            s[i] = s[i-1] +arr[i];
        }
        for(int i=1;i<=n;i++){
          ans +=arr[i]*( s[n]-s[i]);
        }
        System.out.println(ans);
        scan.close(); 
    }
}